package com.cby.android.sample.repository.api

import com.cby.android.sample.bean.roll.*
import retrofit2.http.GET
import retrofit2.http.Headers
import retrofit2.http.Path
import retrofit2.http.Query

/**
 * @description: RollService
 *
 * @author ChenBaoyang
 * @date 4/22/21 17:26
 */
interface RollService {

    @Headers(
        "app_id:" + ApiSource.ROLL_TOOLS_APP_ID,
        "app_secret:" + ApiSource.ROLL_TOOLS_APP_SECRET
    )
    @GET("/api/qrcode/create/single")
    suspend fun getQRCode(
        @Query("content") date: String?, @Query("type") type: Int
    ): RollApiResponse<RollQRCodeBean?>

    @Headers(
        "app_id:" + ApiSource.ROLL_TOOLS_APP_ID,
        "app_secret:" + ApiSource.ROLL_TOOLS_APP_SECRET
    )
    @GET("/api/holiday/single/{date}")
    suspend fun getHolidaySingle(
        @Path("date") date: String?
    ): RollApiResponse<RollDayBean?>


    @Headers(
        "app_id:" + ApiSource.ROLL_TOOLS_APP_ID,
        "app_secret:" + ApiSource.ROLL_TOOLS_APP_SECRET
    )
    @GET("/api/jokes/list")
    suspend fun getJokeList(
        @Query("page") page:Int
    ): RollApiResponse<RollPageApiResponse<RollJokeBean>>

    @Headers(
        "app_id:" + ApiSource.ROLL_TOOLS_APP_ID,
        "app_secret:" + ApiSource.ROLL_TOOLS_APP_SECRET
    )
    @GET("/api/weather/current/{cityName}")
    suspend fun getCityWeatherCurrentDays(
        @Path("cityName") cityName: String?
    ): RollApiResponse<RollWeatherBean?>

    @Headers(
        "app_id:" + ApiSource.ROLL_TOOLS_APP_ID,
        "app_secret:" + ApiSource.ROLL_TOOLS_APP_SECRET
    )
    @GET("/api/weather/forecast/{cityName}")
    suspend fun getCityWeatherFutureDays(
        @Path("cityName") cityName: String?
    ): RollApiResponse<RollForecastsBean>

    @Headers(
        "app_id:" + ApiSource.ROLL_TOOLS_APP_ID,
        "app_secret:" + ApiSource.ROLL_TOOLS_APP_SECRET
    )
    @GET("/api/history/today?type=1")
    suspend fun getHistoryToday(): RollApiResponse<List<RollHistoryBean>>


    @Headers(
        "app_id:" + ApiSource.ROLL_TOOLS_APP_ID,
        "app_secret:" + ApiSource.ROLL_TOOLS_APP_SECRET
    )
    @GET("/api/convert/dictionary")
    suspend fun convertDictionary(
        @Query("content") content: String?
    ): RollApiResponse<List<RollDictionaryBean>>

    @Headers(
        "app_id:" + ApiSource.ROLL_TOOLS_APP_ID,
        "app_secret:" + ApiSource.ROLL_TOOLS_APP_SECRET
    )
    @GET("/api/rubbish/type")
    suspend fun getRubbishType(
        @Query("name") name: String?
    ): RollApiResponse<RollRubbishBean>

    @Headers(
        "app_id:" + ApiSource.ROLL_TOOLS_APP_ID,
        "app_secret:" + ApiSource.ROLL_TOOLS_APP_SECRET
    )
    @GET("/api/mobile_location/aim_mobile")
    suspend fun getMobileLocation(
        @Query("mobile") mobile: String?
    ): RollApiResponse<RollMobileBean>

    @Headers(
        "app_id:" + ApiSource.ROLL_TOOLS_APP_ID,
        "app_secret:" + ApiSource.ROLL_TOOLS_APP_SECRET
    )
    @GET("/api/ip/self")
    suspend fun getIpLocationSelf(): RollApiResponse<RollIpBean?>

    @Headers(
        "app_id:" + ApiSource.ROLL_TOOLS_APP_ID,
        "app_secret:" + ApiSource.ROLL_TOOLS_APP_SECRET
    )
    @GET("/api/ip/aim_ip")
    suspend fun getIpLocation(
        @Query("ip") ip: String?
    ): RollApiResponse<RollIpBean?>

    @Headers(
        "app_id:" + ApiSource.ROLL_TOOLS_APP_ID,
        "app_secret:" + ApiSource.ROLL_TOOLS_APP_SECRET
    )
    @GET("/api/phone_code/list")
    suspend fun getWorldPhoneCode(): RollApiResponse<List<RollPhoneBean>>

    @Headers(
        "app_id:" + ApiSource.ROLL_TOOLS_APP_ID,
        "app_secret:" + ApiSource.ROLL_TOOLS_APP_SECRET
    )
    @GET("/api/news/types")
    suspend fun getNewsTypes(): RollApiResponse<List<RollNewsTypeBean>>


    @Headers(
        "app_id:" + ApiSource.ROLL_TOOLS_APP_ID,
        "app_secret:" + ApiSource.ROLL_TOOLS_APP_SECRET
    )
    @GET("/api/news/list")
    suspend fun getNewsList(
        @Query("typeId") typeId: Int,
        @Query("page") page: Int
    ): RollApiResponse<List<RollNewsInfoBean>>

    @Headers(
        "app_id:" + ApiSource.ROLL_TOOLS_APP_ID,
        "app_secret:" + ApiSource.ROLL_TOOLS_APP_SECRET
    )
    @GET("/api/news/details")
    suspend fun getNewsDetail(
        @Query("newsId") newsId: Int
    ): RollApiResponse<RollNewsDetailBean>

}